package com.iss.apartmentmanage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.iss.apartmentmanage.entity.Menu;
import com.iss.apartmentmanage.entity.Role;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Mapper
@Repository
public interface RoleMapper extends BaseMapper<Role> {
    @Select("select u_id,u_name,role_name from user inner join user_role on u_id=user_id where u_id=#{" +
            "u_id} ")
    List<Role> selectRoleByUserId(Integer id);

    @Select("insert into role_menu(`role_id`, `menu_id`, `create_time`) values(#{role_id},#{menu_id},#{create_time})")
    Integer addRoleMenu(Integer role_id, Integer menu_id, Date create_time);

}
